package com.shu.logsearch.jsch.boot;

import cn.hutool.core.io.FileUtil;
import com.shu.logsearch.config.FileProperties;
import com.shu.logsearch.es.model.LogDoc;
import com.shu.logsearch.es.service.ESRestService;
import com.shu.logsearch.es.service.TikaService;
import com.shu.logsearch.jsch.util.FtpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.io.File;
import java.util.Arrays;

/**
 * 从服务器下载日志文件
 *
 * @author Tree Cai
 * @date 2019/7/1
 */
@Order(1)
@Component
public class DownloadFileApplicationRunner implements ApplicationRunner {

    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    FtpUtil ftpUtil;

    @Override
    public void run(ApplicationArguments args) throws Exception{
        String localFile = "file/";
        String remoteFile = "/usr/local/tomcat_test1/logs/";
//        ftpUtil.downAllFile(remoteFile, localFile);
    }
}
